public class Context
{
  public static void main(String[] args) {
    Bank aBank = (Bank)Helper.newBean("Bank");
    Customer aCustomer = (Customer)Helper.newBean("Customer");
    Salesman aSalesman = (Salesman)Helper.newBean("Salesman");
    Product aProduct = (Product)Helper.newBean("Product");
    Boss aBoss = (Boss)Helper.newBean("Boss");
    
    aSalesman.addPropertyChangeListener(aBoss);
    
    if (args.length == 1 && args[0].equals("first")) {
      aProduct.setArticle(new Clothes("T-shirt"));
      aProduct.setColor("green");
      aProduct.setPrice(14);
      aProduct.saveProduct();
    }

    aSalesman.setOfferedProduct(aProduct);

    aCustomer.setBank(aBank);
    aBank.setCustomer(aCustomer);
    aCustomer.setMySalesman(aSalesman);
    // composing only, so not:
    // if (!aSalesman.getBusy()) aCustomer.setMySa...
    
    // trigger something
    aCustomer.buy(aProduct.getArticle().getName());
    aCustomer.buy(aProduct.getArticle().getName());
    
    aProduct.setSold(false);
    aCustomer.buy(aProduct.getArticle().getName());
  }
}
    

 

    
    
